<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/5/23
  Time: 11:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    // page只在当前页有效
    pageContext.setAttribute("name", "马斯克");

    //request在一次请求中有效
    request.setAttribute("reqName", "龙傲天");
    //转发：
    //request.getRequestDispatcher("page2.jsp").forward(request,response);

    //session:在一次会话中有效
    session.setAttribute("sesName", "帝释天");

    //application：在整个网站内有效
    application.setAttribute("appName","一休哥");
%>
<h3>page:<%=pageContext.getAttribute("name")%>
    <hr>
    <h3>request:<%=request.getAttribute("reqName")%>
    </h3>
    <hr>
    <h3>session:<%=session.getAttribute("sesName")%>
    </h3>
    <hr>
    <h3>application:<%=application.getAttribute("appName")%></h3>
    <a href="page2.jsp">page2</a>
</body>
</html>
